package org.jeecg.modules.rule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.rule.entity.Rule;
import org.jeecg.modules.rule.mapper.RuleMapper;
import org.jeecg.modules.rule.service.IRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 规则code管理
 * @Author: jeecg-boot
 * @Date:   2019-05-22
 * @Version: V1.0
 */
@Service
public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements IRuleService {

    @Autowired
    RuleMapper ruleMapper;

    @Override
    public String getAlgorithmByRuleType(String fdRulename, String fdRulelevel) {
        QueryWrapper<Rule> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("fd_ruletype",fdRulename);
        queryWrapper.eq("fd_rulelevel",fdRulelevel);
        Rule rule = ruleMapper.selectOne(queryWrapper);
        if(null != rule){
            return rule.getFdAlgorithm();
        }
        return null;
    }
}
